package org.example.controller;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.apache.rocketmq.spring.core.RocketMQTemplate;

@RestController
@RequestMapping("/mqMessageController")
public class ProducerController {
    private static final Logger log = LoggerFactory.getLogger(ProducerController.class);

    @Autowired
    private RocketMQTemplate rocketMQTemplate;

    @RequestMapping("/pushMessage.action")
    public String get(@RequestParam("id") int id) {
        rocketMQTemplate.convertAndSend("first-topic","你好,我的小可爱" + id);

        return "connected";
    }
}
